package com.li.utilstest

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.activity.viewModels
import com.blankj.utilcode.util.ToastUtils
import com.li.utilstest.dialog.CenterDialog
import com.li.utilstest.dialog.DeleteBottomDialog
import com.li.utilstest.dialog.DialogUtil
import com.li.utilstest.net.NetStatus
import com.zy.multistatepage.MultiStateContainer
import com.zy.multistatepage.bindMultiState
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {
    val vm by viewModels<MyViewModel>()
    var statePage:MultiStateContainer?=null
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        statePage=content.bindMultiState()
        tv_click.setOnClickListener {
           /*var intent=Intent(this,ImageBrowserActivity::class.java)
            startActivity(intent)*/
            vm.testStatePage(1).observe(this){
                when(it.status){
                    NetStatus.LOAD -> statePage!!.load()
                    NetStatus.SUCCESS -> {
                        statePage!!.success()
                        ToastUtils.showShort("请求成功")
                    }
                    NetStatus.ERROR -> {
                        statePage!!.showError()
                    }
                    NetStatus.EMPTY -> statePage!!.showEmpty(it.msg)
                }
            }
        }

        screen_record.setOnClickListener {
            var intent = Intent(this, ScreenRecordActivity::class.java)
            startActivity(intent)
        }
    }
}